const mongoose = require('mongoose');

const { Classify } = require('../../model/classify');
const { Article } = require('../../model/article');

module.exports = async (req, res) => {
    var id = req.params.id
    try {
        var data = await Classify.deleteOne({ _id: id })
        // console.log(data);
        
    } catch {
        return res.send({
            data: null,
            meta: {
                status: 400,
                msg: '删除失败'
            }
        })
    }
    data = await Article.updateMany({ class: id }, { class: '61da9432b9230e04e9aad81b' })
    res.send({
        data: null,
        meta: {
            status: 204,
            msg: '删除成功'
        }
    })


}